#pragma once
#include "GRiPreInclude.h"
#include "GRiMesh.h"
#include <DirectXMath.h>
#include <map>
class GRiSceneObject
{
	

public:
	GRiSceneObject() = default;
	GRiSceneObject(const GRiSceneObject & rhs) = delete;


	void SetMesh(GRiMesh* mesh);
	GRiMesh* GetMesh();


	GRiMaterial* GetOverrideMaterial(std::string submeshName);

	//std::map<std::string, std::string> GetOverrideMaterialNames();

	std::vector<float> GetLocation();
	std::vector<float> GetRotation();
	std::vector<float> GetScale();
	void SetLocation(float x, float y, float z);
	void SetRotation(float pitch, float yaw, float roll);
	void SetScale(float x, float y, float z);

	void UpdateTransform();

	// Give it a name so we can look it up by name.
	std::string UniqueName;

	DirectX::XMFLOAT4X4 GetTransform();
	
	void SetOverrideMaterial(std::string submeshName, GRiMaterial* mat);

private:
	bool bTransformDirty;

	float Location[3] = { 0.0f, 0.0f, 0.0f };
	float Rotation[3] = { 0.0f, 0.0f, 0.0f };
	float Scale[3] = { 1.0f, 1.0f, 1.0f };
	DirectX::XMFLOAT4X4 mWorld;

	// Index into GPU constant buffer corresponding to the ObjectCB for this render item.
	UINT ObjIndex = -1;

	//GRiMaterial* Mat = nullptr;

	
	std::unordered_map<std::string, GRiMaterial*> pOverrideMaterial;
	GRiMesh* pMesh;

};

